package com.atguigu.gulimall.ware.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.atguigu.gulimall.ware.entity.ShAreaEntity;
import com.atguigu.gulimall.ware.service.ShAreaService;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.common.utils.R;



/**
 * 全国省市区信息
 *
 * @author pan
 * @email 2294104630@qq.com
 * @date 2024-03-04 21:45:36
 */
@RestController
@RequestMapping("ware/sharea")
public class ShAreaController {
    @Autowired
    private ShAreaService shAreaService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("ware:sharea:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = shAreaService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
   // @RequiresPermissions("ware:sharea:info")
    public R info(@PathVariable("id") Integer id){
		ShAreaEntity shArea = shAreaService.getById(id);

        return R.ok().put("shArea", shArea);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
   // @RequiresPermissions("ware:sharea:save")
    public R save(@RequestBody ShAreaEntity shArea){
		shAreaService.save(shArea);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
   // @RequiresPermissions("ware:sharea:update")
    public R update(@RequestBody ShAreaEntity shArea){
		shAreaService.updateById(shArea);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("ware:sharea:delete")
    public R delete(@RequestBody Integer[] ids){
		shAreaService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
